<template>
  <div class="index-swiper">
    <swiper :options="swiperOption" v-if="hasListData">
      <swiper-slide v-for="item in list" :key="item.id">
        <img :src="item.imgUrl" alt="">
      </swiper-slide>
      <div class="swiper-pagination"></div>
    </swiper>
  </div>
</template>
<script>
import { computed } from 'vue'
export default {
  name: 'HomeSwiper',
  props: {
    list: Array
  },
  setup(props){
    let swiperOption = {
      loop: true
    }
    let hasListData = computed(()=>{
      return props.list.length
    })
    return { swiperOption, hasListData }
  }
}
</script>
<style lang="stylus" scoped>
  .index-swiper >>> .swiper-pagination-bullet-active
    background #fff !important
  .index-swiper
    height 0
    overflow hidden
    padding-bottom 30.5%
    background-color #ccc;
    .swiper-wrapper
      position relative
      img
        width 100%
</style>
